#pragma once

#include <thrust/generate.h>

template <typename Container,
          typename Generator>
struct Generate
{
  Container A;
  Generator gen;

  template <typename Range>
  Generate(const Range& X, Generator gen)
    : A(X.begin(), X.end()),
      gen(gen)
  {}

  void operator()(void)
  {
    thrust::generate(A.begin(), A.end(), gen);
  }
  
  void reset(void)
  {
    // nothing to do
  }
};

template <typename Container,
          typename Generator>
struct GenerateN
{
  Container A;
  Generator gen;

  template <typename Range>
  GenerateN(const Range& X, Generator gen)
    : A(X.begin(), X.end()),
      gen(gen)
  {}

  void operator()(void)
  {
    thrust::generate_n(A.begin(), A.size(), gen);
  }
  
  void reset(void)
  {
    // nothing to do
  }
};

